<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace HyperfTest\Cases;

use App\Service\Redis\UserAuth;
use HyperfTest\HttpTestCase;

/**
 * @internal
 * @coversNothing
 */
class QuestionTest extends HttpTestCase
{
    public function testQuestionPublish()
    {
        $res = $this->json('/question/1', [
            'title' => '有人抄我作业，我能搞他么？',
            'summary' => '我们学校的校霸抄我作业，还把我作业给扔了，我想找点人办他！！' . uniqid(),
            'category_id' => 11,
        ], [
            UserAuth::X_TOKEN => $this->getToken(),
        ]);

        $this->assertSame(0, $res['code']);
    }

    public function testQuestionDelete()
    {
        $res = $this->json('/question/2/delete', [], [
            UserAuth::X_TOKEN => $this->getToken(),
        ]);

        $this->assertSame(0, $res['code']);
    }

    public function testQuestionIndex()
    {
        $res = $this->get('/question', [
            'category_id' => 11,
        ]);

        $this->assertSame(0, $res['code']);
    }
}
